package com.mobileares.midp.widgets.client.panel;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.Widget;

import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: Tom
 * Date: 2011-10-29
 * Time: 17:23:51
 * To change this template use File | Settings | File Templates.
 */
public class MyStackPanel extends StackPanel {
//    private ArrayList<Widget> scrollers = new ArrayList<Widget>();

    public MyStackPanel() {
        setStyleName("fish-StackPanel");
//          setWidth("96%");
    }

//    public void insert(Widget w, int before) {
//        ScrollPanel p = new ScrollPanel(w);
//        p.setWidth("100%");
//        scrollers.add(before, p);
//        super.insert(p, before);
//    }
//
//    public void onLoad() {
//        setWidth("96%");
//        if (getSelectedIndex() != -1)
//            showStack(getSelectedIndex());
//    }
//
//    /**
//     * Shows the widget at the specified child index.
//     *
//     * @param index the index of the child to be shown
//     */
//    public void showStack(int index) {
//        super.showStack(index);

//        if (this.isAttached()) {
//            ScrollPanel me = (ScrollPanel) scrollers.get(index);
//            me.setHeight("1px");
//            Element tr = DOM.getChild(DOM.getFirstChild(getElement()),
//                    index * 2 + 1);
//            int trHeight = DOM.getElementPropertyInt(tr, "offsetHeight");
//            System.out.println(trHeight+"-----");
//            me.setHeight(trHeight + "px");
//
//        }
//    }
}